# !/bin/bash

source ./vars.sh

router_dir=/usr/local/mysqlrouter


echo "install mysql router"

rm -rf  ${router_dir}

echo "extract mysql router"
tar xvf ${work_dir}/mysql-router-8.0.26-linux-glibc2.17-x86_64-minimal-rebuild.tar.xz -C /usr/local
sudo chmod 0700 /usr/local/mysql-router-8.0.26-linux-glibc2.17-x86_64-minimal-rebuild

echo "rename tarball"
sudo mv /usr/local/mysql-router-8.0.26-linux-glibc2.17-x86_64-minimal-rebuild ${router_dir}
sudo chown mysql:mysql ${router_dir}

echo "export PATH=$PATH:/usr/local/mysqlrouter/bin" > /etc/profile.d/mysqlrouter.sh

source /etc/profile.d/mysqlrouter.sh